3.5_480x320_TFT_LCD_With_Cap_Touch_SKU_DFR0669

1. Introduction

This is a 3.5-inch capacitive touch screen supporting color display, only palm-sized with a resolution of 480×320, making it an ideal choice for display projects.

Utilizing high-quality IPS panel and optical bonding technology, it delivers a 178° wide viewing angle and clear display.
It supports 5-point sensitive capacitive touch. IPS technology ensures vivid, true-to-life colors from any angle with reduced glare and reflections; optical bonding prevents dust ingress, ensuring clearer display and reliable quality.

Two flexible hardware connection options simplify wiring.
In addition to the universal SPI pin header interface, it also provides a GDI interface (compatible with the Firebeetle 2 ESP32 series), enabling plug-and-play with a single FPC cable.

Designed for various display application scenarios to accelerate project implementation.
The screen features bright display, wide viewing angle, simple wiring, and rugged durability, making it suitable for IoT control panels, desktop weather information displays, portable game consoles, and various touch interactive interfaces.
Furthermore, the screen comes with an onboard Micro SD card slot, eliminating the need for additional expansion. It is compatible with the Arduino GDL library and provides abundant examples, enabling easy implementation from drawing basic graphics to creating complex UI controls like progress bars, buttons, numeric keypads, significantly speeding up the development process

2. Features

  • 480×320 high-definition resolution for delicate and realistic images
  • Compact 3.5-inch size, fitting in the palm of your hand
  • 178° full-view IPS hard panel for true and vivid colors
  • 5-point capacitive touch with sensitive response and smooth operation
  • Optical full bonding technology for better light transmittance and dust resistance
  • GDI one-cable connection for plug-and-play and simplified wiring
  • Dual-interface compatibility, supporting SPI and GDI for flexible connection
  • Built-in Micro SD card slot for easy storage expansion

3. Applications

  • Portable sensor data dashboard
  • Desktop weather information screen
  • Hardware status monitoring screen
  • Programmable multi-function calculator
  • Retro game console interaction interface
  • IoT smart home control center

4. Specifications

Basic Parameters

  • Operating Voltage: DC 3.3V ~ 5V
  • Operating Current: 50mA@5V
  • Communication Interface: SPI / GDI

Screen Parameters

  • Screen Size: 3.5 inches
  • Resolution: 480 × 320 (HVGA)
  • Panel Type: IPS
  • Viewing Angle: 178° (full view)
  • Brightness: 300 cd/m²
  • Contrast Ratio: 800:1
  • Surface Treatment: Anti-fingerprint (AF) coating
  • Production Process: Optical full bonding
  • Effective Display Area: 48.96 × 73.94 mm

Touch Characteristics

  • Touch Type: Capacitive
  • Touch Points: 5 points
  • Touch Interface: SPI/GDI

Mechanical Structure

  • Overall Dimensions: 95.0 × 54.5 × 5.7 mm
  • Mounting Hole Diameter: 2.0 mm
  • Mounting Hole Spacing: 90 × 50 mm
  • Weight: 62.6g (with packaging)

Expansion Functions

  • Storage Expansion: Built-in Micro SD card slot

Software Support

  • Compatible with Arduino GDL library

5. Interface Description

2.54 Pin interface description

Pin No. Name Function Description
1 VCC Positive Power Supply
2 GND Negative Power Supply
3 SCLK Clock
4 MOSI Data (Host Transmits, Slave Receives)
5 MISO Data (Host Receives, Slave Transmits)
6 SCR_CS Screen Chip Select
7 RST Reset
8 DC Data/Command
9 BLK Backlight. The backlight has a default setting, so the user can turn on the screen without connecting the backlight pin; in addition, when the backlight pin is connected, inputting a high level (1) sets the backlight brightness to maximum, and inputting a low level (0) turns off the backlight.
10 SCL Touch Clock
11 SDA Touch Data
12 INT Touch Interrupt
13 SD_CS SD Card Chip Select
14 TP_R Touch Reset

GDI interface description

This is a DFRobot-specific GDI display interface. Connect the screen using an 18-pin FPC cable for more convenient connection.
When connecting the screen with an FPC cable, simply configure the corresponding pin numbers according to the GDL demo.

The pin mapping is as follows:

FPC PINS Description
VCC 3V3
LCD_BL Backlight
GND GND
SCLK SPI Clock
MOSI Host Output, Slave Input
MISO Host Input, Slave Output
LCD_DC Data/Command
LCD_RST Reset
LCD_CS Screen Chip Select
SD_CS SD Card Chip Select
FCS Font Chip Select
TCS Touch Chip Select
SCL I2C Clock
SDA I2C Data
INT INT
BUSY Tear-Effect Pin
X1 Custom Pin 1
X2 Custom Pin 2

6. Dimension Diagram

7. Arduino Tutorial

7.1 Precautions Before Use

  • The GDI interface must be used with a main controller that has a GDI interface.
  • It is recommended to use Arduino 1.8.10 or a later version.
  • Poor contact of the SD card slot may cause initialization failure; reinserting the SD card may resolve the issue.

7.2 Hardware Preparation

7.3 Software Preparation

7.4 Hardware Connection

GDI Cable Connection Method

2.54 Pin Header Connection Method

  • Display VCC ---- Connect ---- Controller 3V3
  • Display GND ---- Connect ---- Controller GND
  • Display CLK ---- Connect ---- Controller SCK
  • Display SI ---- Connect ---- Controller MO
  • Display SO ---- Connect ---- Controller MI
  • Display SCR_CS ---- Connect ---- Controller D6
  • Display RST ---- Connect ---- Controller D3
  • Display DC ---- Connect ---- Controller D2
  • Display BL ---- Connect ---- Controller D13
  • Display SCL ---- Connect ---- Controller SCL
  • Display SDA ---- Connect ---- Controller SDA
  • Display INT ---- Connect ---- Controller D11
  • Display SD_CS ---- Do not use / Leave unconnected
  • Display TP_R ---- Connect ---- Controller D10

7.5 Application Examples

Note:

  • All demonstration demos for this product are stored in the DFRobot_GDL->example->basic folder.
  • Before burning the demo, enable the corresponding instantiation function (DFRobot_ST7365P_320x480_HW_SPI).

7.5.1 Example Code 1 - basicTest

Program Description: This is a basic display example, including drawing points, lines, circles, rectangles, etc.

#include "DFRobot_GDL.h"
/*ESP32 and ESP8266*/
#if defined(ESP32) || defined(ESP8266)
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3
#define TFT_BL  D13
#define TFT_SD  D7
#endif

DFRobot_ST7365P_320x480_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST,/*bl=*/TFT_BL);

void setup() {
  Serial.begin(115200);
  screen.begin();
}

void loop(){
    testDrawPixel();
    testLine();
    testFastLines(COLOR_RGB565_PURPLE,COLOR_RGB565_YELLOW);       
    testRects(COLOR_RGB565_BLACK,COLOR_RGB565_WHITE);
    testRoundRects();
    testCircles(24,COLOR_RGB565_BLUE);
    testTriangles(COLOR_RGB565_YELLOW);
    testPrint();

}

/* Test to draw a pixel*/
void testDrawPixel() {
  //Clear screen
  screen.fillScreen(COLOR_RGB565_BLACK);
  int x = 0;
  int y = screen.height();
  for(int i = 0; i <= screen.width()/2; i += 10){
    for (x = screen.width() - i; x >= i; x-=10 ){
      /*
       * @ brief draw a pixel
       * @ param x coordinate
       *         y coordinate
       * c pixel color
       */
      screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
      delay(10);
    }
  
    for (y = screen.height() - i; y >= i; y-=10){
      screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
      delay(10);
    }
  
    for (x = i; x <= screen.width() - i + 1; x+=10 ){
      screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
      delay(10);
    }
  
    for (y = i; y <= screen.height() - i + 1; y+=10){
      screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
      delay(10);
    }
  }
}

/* Test to draw a line*/
void testLine(){
// 0x00FF is the color data in the format of RGB565
  uint16_t color = 0x00FF;
  screen.fillScreen(COLOR_RGB565_BLACK);
  for (int16_t x=0; x < screen.width(); x+=6) {
    /*
     * @ brief draw a line
     * @ param x0 The x-coordinate of the first vertex
     *         y0 The y-coordinate of the first vertex
     *         x1 The x-coordinate of the second vertex
     *         y1 The y-coordinate of the second vertex
     *         c line color
     */
    screen.drawLine(/*x0=*/screen.width()/*Screen width*//2, /*y0=*/screen.height()/*Screen height*//2, /*x1=*/x, /*y1=*/0, /*c=*/color+=0x0700);
  }
  for (int16_t y=0; y < screen.height(); y+=6) {
    screen.drawLine(screen.width()/2, screen.height()/2, screen.width(), y, color+=0x0700);
  }
 
  for (int16_t x = screen.width(); x >= 0; x-=6) {
    screen.drawLine(screen.width()/2, screen.height()/2, x,screen.height(), color+=0x0700);
  }
  
  for (int16_t y = screen.height(); y >= 0; y-=6) {
    screen.drawLine(screen.width()/2, screen.height()/2, 0, y, color+=0x0700);
  }
}

/* Test to fast draw line(need to set delay), only horizontal line and vertical line */
void testFastLines(uint16_t color1, uint16_t color2) {
  for (int16_t y=0; y < screen.height(); y+=4) {
    /*
     * @ brief draw a line
     * @ param x The x-coordinate of the first vertex
     *         y The y-coordinate of the first vertex
     *         w Length of line segment
     *         c line color
     */
    screen.drawFastHLine(/*x=*/0, /*y=*/y, /*w=*/screen.width(),/*c=*/color2);
    delay(10);
  }
  
  for(int16_t x=0; x < screen.width(); x+=3) {
    /*
     * @ brief draw a line
     * @ param x The x-coordinate of the first vertex
     *         y The y-coordinate of the first vertex
     *         h length of line segment
     *         c line color
     */
    screen.drawFastVLine(/*x=*/x, /*y=*/0, /*h=*/screen.height(), /*c=*/color1);
    delay(10);
  }
}

/* Test to draw a rectangle*/
void testRects(uint16_t color1, uint16_t color2) { 
    screen.fillScreen(COLOR_RGB565_BLACK);
    int16_t x=screen.width()-12;
    for (; x > 100; x-=screen.width()/40) {
      /*
       * @ brief draw a hollow rectangle
       * @ param x The x-coordinate of the vertex 
       * @ param y The y-coordinate of the vertex
       * @ param w horizontal side length
       * @ param h longitudinal side length
       * @ param color Fill color, RGB color with 565 structure
       */
      screen.drawRect(/*x=*/screen.width()/2 -x/2, /*y=*/screen.height()/2 -x/2 , /*w=*/x, /*h=*/x, /*color=*/color2+=0x0F00);
      delay(100);
    }
  
    /*
     * @ brief draw a filled rectangle
     * @ param x The x-coordinate of the vertex
     * @ param y The y-coordinate of the vertex
     * @ param w horizontal side length
     * @ param h longitudinal side length
     * @ param color Fill color, RGB color with 565 structure
     */
    screen.fillRect(/*x=*/screen.width()/2 -x/2, /*y=*/screen.height()/2 -x/2 , /*w=*/x, /*h=*/x, /*color=*/color2);
    delay(100);
    for(; x > 6; x-=screen.width()/40){
      screen.drawRect(screen.width()/2 -x/2, screen.height()/2 -x/2 , x, x, color1);
      delay(100);
    }
}

/* Test to draw a rounded rectangle */
void testRoundRects() {
  screen.fillScreen(COLOR_RGB565_BLACK);
// 0xF00F is the color data in the format of RGB565
  int color = 0xF00F;
  int i;
  int x = 0;
  int y = 0;
  int w = screen.width()-3;
  int h = screen.height()-3;
  for(i = 0 ; i <= 16; i+=2) {
    /*
     * @ brief Draw a hollow rounded rectangle
     * @ param x0 The x-coordinate of the start vertex 
     * @ param y0 The y-coordinate of the start vertex 
     * @ param w horizontal side length
     * @ param h longitudinal side length
     * @ param radius Round corner radius
     * @ param color border color, 565 structure RGB color
     */
    screen.drawRoundRect(/*x0=*/x, /*y0=*/y, /*w=*/w, /*h=*/h, /*radius=*/20, /*color=*/color);
    x+=5;
    y+=5;
    w-=10;
    h-=10;
    color+=0x0100;
    delay(50);
  }
  for(i = 0 ; i <= 16; i+=2) {
    /*
     * @ brief Draw a filled and rounded rectangle
     * @ param x0 The x-coordinate of the start vertex
     * @ param y0 The y-coordinate of the start vertex
     * @ param w horizontal side length
     * @ param h longitudinal side length
     * @ param radius Round corner radius
     * @ param color Fill color, RGB color with 565 structure
     */
    screen.fillRoundRect(/*x0=*/x, /*y0=*/y, /*w=*/w, /*h=*/h, /*radius=*/10, /*color=*/color);
    x+=5;
    y+=5;
    w-=10;
    h-=10;
    color+=0x0500;
    delay(50);
  }
}

/* Test to draw a circle */
void testCircles(uint8_t radius, uint16_t color) {
  screen.fillScreen(COLOR_RGB565_BLACK);
  for (int16_t x=radius; x <=screen.width()-radius; x+=radius*2) {
    for (int16_t y=radius; y <=screen.height()-radius; y+=radius*2) {
      /*
       * @ brief Draw a hollow circle
       * @ param x0 The x-coordinate of the center point
       * @ param y0 The y-coordinate of the center point
       * @ param r radius
       * @ param color Circle color, RGB color with 565 structure
       */
      screen.drawCircle(/*x0=*/x, /*y0=*/y, /*r=*/radius, /*color=*/color);
        if(x == y ||x == -y ||x == y + 2*radius)
          /*
           * @ brief Draw a filled circle
           * @ param x0 The x-coordinate of the center point
           * @ param y0 The y-coordinate of the center point
           * @ param r radius
           * @ param color Fill color, RGB color with 565 structure
           */
          screen.fillCircle(/*x0=*/x, /*y0=*/y, /*r=*/radius, /*color=*/color);
       color += 800;
       delay(100);
    }
  }
}

/* Test to draw a triangle */
void testTriangles(uint16_t color){
  screen.fillScreen(COLOR_RGB565_BLACK);
  
  for (int16_t i=0; i <=screen.width(); i+=24)
    /*
     * @ brief Draw a hollow triangle
     * @ param x0 The x-coordinate of the start vertex
     * @ param y0 The y-coordinate of the start vertex
     * @ param x1 The x-coordinate of the second vertex
     * @ param y1 The y-coordinate of the second vertex
     * @ param x2 The x-coordinate of the third vertex
     * @ param y2 The y-coordinate of the third vertex
     * @ param color border color, 565 structure RGB color
     */
    screen.drawTriangle(/*x0=*/i,/*y0=*/0,/*x1=*/0,/*y1=*/screen.height()-i,/*x2=*/screen.width()-i,/*y2=*/screen.height(), /*color=*/color);
  
  for (int16_t i=0; i <screen.width(); i+=24)
    screen.drawTriangle(screen.width(),i*4/3,0,screen.height()-i*4/3,i,0, color);

  for (int16_t i=0; i <screen.width(); i+=24)
    screen.drawTriangle(screen.width(),i*4/3,i,0,screen.width()-i,screen.height(), color);

  color = COLOR_RGB565_RED;
  for (int16_t i=0; i <=screen.width(); i+=24)
     /*
      * @ brief Draw a filled triangle
      * @ param x0 The x-coordinate of the start vertex
      * @ param y0 The y-coordinate of the start vertex
      * @ param x1 The x-coordinate of the second vertex
      * @ param y1 The y-coordinate of the second vertex
      * @ param x2 The x-coordinate of the third vertex
      * @ param y2 The y-coordinate of the third vertex
      * @ param color Fill color, RGB color with 565 structure
      */
    screen.fillTriangle(/*x0=*/i,/*y0=*/0,/*x1=*/0,/*y1=*/screen.height()-i,/*x2=*/screen.width()-i,/*y2=*/screen.height(), /*color=*/color+=100);
  
  for (int16_t i=0; i <screen.width(); i+=24)
    screen.fillTriangle(screen.width(),i*4/3,0,screen.height()-i*4/3,i,0, color+=100);

  for (int16_t i=0; i <screen.width(); i+=24)
    screen.fillTriangle(screen.width(),i*4/3,i,0,screen.width()-i,screen.height(), color+=100);
}

void testPrint() {
  // 0x00FF is the color data in the format of RGB565
  int16_t color = 0x00FF;
   // Set text wrapping mode
   // true = Text word wrap, false = No word wrap
  screen.setTextWrap(false);
  //Fill color, RGB color with 565 structure
  screen.fillScreen(COLOR_RGB565_BLACK);
  
  //Set the coordinate position x = 0, y = 50
  screen.setCursor(0, 50);
  //Set the text color; this is a changeable value
  screen.setTextColor(color+=0x3000);
  //Set text size to 0
  screen.setTextSize(0);
  //Output text
  screen.println("Hello World!");
  
  screen.setTextColor(color+=0x3000);
  //Set text size to 1
  screen.setTextSize(1);
  screen.println("Hello World!");
  
  screen.setTextColor(color+=0x3000);
  //Set text size to 2
  screen.setTextSize(2);
  screen.println("Hello World!");
  
  screen.setTextColor(color+=0x3000);
  //Set text size to 3
  screen.setTextSize(3);
  screen.println("Hello World!");
  
  screen.setTextColor(color+=0x3000);
  //Set text size to 4
  screen.setTextSize(4);
  screen.println("Hello!"); 
  //Set text size to 5
  screen.setTextSize(5);
  screen.print("Hello!");
  delay(2000);
  
  //Set coordinate position x = 0, y = 0
  screen.setCursor(0, 0);
  //Fill color, RGB color with 565 structure
  screen.fillScreen(COLOR_RGB565_BLACK);
  screen.setTextSize(2);
  screen.setTextColor(color+=0x3000);
  screen.print("a = ");
  
  screen.setTextColor(color+=0x3000);
  int a = 1234;
  screen.println(a, 1);
  screen.setTextColor(color+=0x3000);
  screen.print(8675309, HEX);
  screen.println("this is HEX!");
  screen.println("");
  
  screen.setTextColor(color+=0x0F00);
  screen.println("running for: ");
  screen.setTextColor(color+=0x0F00);
  //Output time in millisecond
  screen.print(millis());
  screen.setTextColor(color+=0x0F00);
  screen.println("/1000 seconds.");
  
  char text[] = "Hi DFRobot!";
  screen.setTextColor(color+=0x0F00);
  screen.setTextWrap(true);
  screen.setTextSize(3);
  screen.println(text);
  //screen.setFonts((const gdl_Font_t *)SIMKAIFont18ptBitmaps);
  screen.println(text);
  delay(2000);
}

7.5.2 Example Code 2 - gettureFont

Program Description: This is a UI control demo—a numeric keypad. First, click the text box to display the cursor, then click the numbers to show the corresponding digits in the text box. The "x" in the bottom right corner of the keypad is used to delete content in the text box.

#include "DFRobot_UI.h"
#include "Arduino.h"
#include "DFRobot_GDL.h"
#include "DFRobot_Touch.h"

/*ESP32 and ESP8266*/
#if defined(ESP32)
#define TFT_DC    D2     
#define TFT_CS    D6      
#define TFT_RST   D3    
#define TFT_BL    D13   
#define TOUCH_RST D10
#define TOUCH_INT D11
#endif

DFRobot_Touch_GT911_IPS touch(0X5D,TOUCH_RST,TOUCH_INT);
DFRobot_ST7365P_320x480_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST,/*bl=*/TFT_BL);

DFRobot_UI ui(&screen, &touch);

void setup()
{

  Serial.begin(9600);

  ui.begin();
  // Set the UI theme, there are two themes to choose from: CLASSIC and MODERN.
  ui.setTheme(DFRobot_UI::CLASSIC);
  
   //Create a numeric keypad
  DFRobot_UI::sObject_t &kp = ui.creatKeyPad();
  ui.draw(&kp);
}

void loop()
{
  // refresh
  ui.refresh();
}

7.5.3 Example Code 3 - UI_gesture

Program Description: This is a gesture reading example. Perform operations in the gesture area: click, double click, long press, upwards slide, down slide, left slide, right slide.

#include "DFRobot_UI.h"
#include "Arduino.h"
#include "DFRobot_GDL.h"
#include "DFRobot_Touch.h"
/*ESP32 and ESP8266*/
#if defined(ESP32)
#define TFT_DC    D2     
#define TFT_CS    D6      
#define TFT_RST   D3    
#define TFT_BL    D13   
#define TOUCH_RST D10
#define TOUCH_INT D11
#endif

DFRobot_Touch_GT911_IPS touch(0X5D,TOUCH_RST,TOUCH_INT);
DFRobot_ST7365P_320x480_HW_SPI screen(/*dc=*/TFT_DC,/*cs=*/TFT_CS,/*rst=*/TFT_RST,/*bl=*/TFT_BL);

DFRobot_UI ui(&screen, &touch);

void setup()
{
  Serial.begin(9600);
  ui.begin();
  // Set the UI theme, there are two themes to choose from: CLASSIC and MODERN.
  ui.setTheme(DFRobot_UI::MODERN);
  
  //Create a text box control
  DFRobot_UI::sTextBox_t &tb = ui.creatText();
  //Create a text box control on the screen and draw the text box according to the customized or initialized parameters
  ui.draw(&tb);
  /**
   * @brief Set the touch gesture recognition area
   */
  ui.setGestureArea(/*x=*/screen.width()/2-75,/*y=*/200,/*width=*/150,/*height=*/200);
  while(true){
     //refresh
    ui.refresh();
    // getGestures(): Get gesture
    switch(ui.getGestures()){
      //setText:let the text box display a string
      case ui.SUPGLIDE : tb.setText("upwards slide"); break;
      case ui.SDOWNGLIDE : tb.setText("down slide"); break;
      case ui.SLEFTGLIDE : tb.setText("left slide"); break;
      case ui.SRIGHTGLIDE : tb.setText("right slide"); break;
      case ui.DLONGPRESSED : tb.setText("long press"); break;
      case ui.SCLICK : tb.setText("click"); break;
      case ui.DDOUBLECLICK : tb.setText("double click"); break;
      default  :  break;
      }
  }
}

void loop()
{
  
}

8. Compatibility Test

MCU Test Passed Test Failed Not Tested Special Notes
FireBeetle-ESP32
FireBeetle-ESP8266
Arduino Uno
Leonardo
Mega2560
Arduino M0

9. Resource Download

10. More

For more questions and interesting applications, you can visit the forum to browse or post!

<File:shopping_car.png> DFRobot Mall Purchase Link